class CreateFollowupRecords < ActiveRecord::Migration[5.1]
  def change
    create_table :followup_records do |t|
      t.datetime :followup_time, null: false, default: '1900-01-01', comment: '安排时间'
      t.string :followup_employee_code, limit: 10, index: true, comment: '跟进人员工编号'
      t.integer :contact_channel, null: false, default: 0, comment: '联系方式 1-电话 2-邮件 3-会面'
      t.string :followup_phase, limit: 10, null: false, default: '', comment: '跟进阶段编码'
      t.integer :followup_status, null: false, default: 0, comment: '跟进状态 0-未完成 1-已完成'
      t.string :note, limit: 200, comment: '备注'
      t.integer :is_delete, default: 0, null: false, comment: '是否删除 1-删除 0-未删除'
      t.string :creator_id, comment: '创建者id'

      t.timestamps
    end
    add_reference :followup_records, :companies, foreign_key: true
    add_reference :followup_records, :contacts, foreign_key: true
  end
end
